#猜数字
import random
num1 = random.randint(1,100)
a = 1
x = 0
while a > 0:
    guess = int(input("请输入数字："))
    x += 1
    if guess == num1 and x <= 3:
        print("你猜的次数是{}，你是师傅".format(x))
        break
    if guess == num1 and 3 < x <= 6:
        print("你猜的次数是{}，你是沙僧".format(x))
        break
    if guess == num1 and x > 6:
        print("你猜的次数是{},你是悟空".format(x))
        break
    if guess > num1:
        print("你输入的数字大了，请重新输入：")
    if guess < num1:
        print("你输入的数字小了，请重新输入：")
#猜年龄
import random
age = random.randint(1,100)
print("你一共有三次机会哦，加油")
for i in range(1,4):
    guess = int(input("请输入你猜的年龄："))
    if guess == age:
        print("恭喜你{}次就猜对了".format(i))
    elif guess > age:
        print("没猜对哦，你猜的数字大了，你还有{}次机会".format(3-i))
    else:
        print("没猜对哦，你猜的数字小了，你还有{}次机会".format(3-i))



